<html lang="zh_CN">
{% include "common/tree_page_head.html" %}
<script type="text/javascript"
        src="{{ url_for('static',filename='system/flow/dwr/dialog/processSelect.js',v='1.0.20220526') }}"></script>
<body onload="pageLoad()">
<div class="easyui-layout" fit="true">
    <div data-options="region:'west',split:true,title:'流程图目录'" style="width: 200px;">
        <div style="width:100%; height:100%; overflow: hidden;">
            <ul id="tree_folder" class="ztree"></ul>
        </div>
    </div>
    <div data-options="region:'center',title:'流程图'" style="overflow: hidden;padding: 0;">
        <script type="text/html" id="list_toolbar">
            <div class="layui-btn-container" style="padding-top: 1px;">
                <div style='float:left; height: 30px;'>
                    <button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="addData"
                            id="addOrgItem"><span
                            class='glyphicon glyphicon-plus'></span>&nbsp;新增
                    </button>
                    <button class="layui-btn layui-btn-sm" lay-event="refreshData"><span
                            class='glyphicon glyphicon-repeat'></span>&nbsp;刷新
                    </button>
                    <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="deleteData"><span
                            class='layui-icon layui-icon-delete'></span>&nbsp;删除
                    </button>
                </div>
                <div class='input-group input-group-sm' style='float:left; width:280px; height: 30px;'>
                    <input type="text" id="search_text" placeholder="快速查询..." class='form-control'>
                    <span class='input-group-btn'>
                        <button class='btn btn-default' lay-event="quickQuery"><span
                                class='glyphicon glyphicon-search'></span>查询</button>
                    </span>
                </div>
            </div>
        </script>
        <table class="layui-table" lay-filter="datalist"
               lay-data="{height:'full-50',url:'/system/flow/dwr/dialog/dataList', page:true, limit:10, even:true, id:'datalist',defaultToolbar:[], toolbar:'#list_toolbar'}">
            <thead>
            <th lay-data="{field:'no', width:60}">序号</th>
            <th lay-data="{field:'sprocessname',edit:'text'}">流程名称</th>
            <th lay-data="{field:'sprocessid',edit:'text'}">流程ID</th>
            <th lay-data="{field:'screatorname', width:90}">创建人</th>
            <th lay-data="{field:'screatetime', width:160}">创建时间</th>
            </thead>
        </table>
    </div>
</div>
</body>
<script type="text/javascript">
    layui.use('table', function () {
        var table = layui.table;

        //头工具栏事件
        table.on('toolbar(datalist)', function (obj) {
            switch (obj.event) {
                case 'addData':
                    addData();
                    break;
                case 'refreshData':
                    loadList();
                    break;
                case 'deleteData':
                    deleteData();
                    break;
                case 'quickQuery':
                    loadList();
                    break;
            }
        });

        //触发行单击事件
        table.on('row(datalist)', function (obj) {
            //console.log(obj.tr) //得到当前行元素对象
            //console.log(obj.data) //得到当前行数据
            obj.tr.parent().find('tr').removeClass('active')
            obj.tr.addClass('active') //选中行加特殊背景颜色
            currentRow = obj.data;
        });

        table.on('edit(datalist)', function (obj) { //注：edit是固定事件名，test是table原始容器的属性 lay-filter="对应的值"
            //console.log(obj.value); //得到修改后的值
            //console.log(obj.field); //当前编辑的字段名
            //console.log(obj.data); //所在行的所有相关数据
            editData(obj.value, obj.field, obj.data);
        });

    });
</script>
</html>